package com.itheima.homework.hw01.part03;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Register {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Set<User> users = new HashSet<>();
        while (true) {
            System.out.print("请输入要注册的账号：");
            String name = sc.next();
            System.out.print("请输入要注册的密码：");
            String password = sc.next();
            User thisUser = new User(name, password);
            if (users.add(thisUser)) {
                System.out.println("注册成功！");
                System.out.println("当前用户有："+users);
            } else {
                System.out.println("注册失败！");
            }
        }
    }

}
